﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AAA.DesignPattern.Singleton
{
    public sealed class SystemParameter
    {
        private static SystemParameter _systemParameter;
        private Dictionary<string, object> _dicParameter;

        private SystemParameter()
        {
            _dicParameter = new Dictionary<string, object>();
        }

        public static SystemParameter Parameter
        {
            get
            {
                if (_systemParameter == null)
                    _systemParameter = new SystemParameter();
                return _systemParameter;
            }
        }

        public object this[string strKey]
        {
            get
            {
                return _dicParameter.ContainsKey(strKey)
                        ? _dicParameter[strKey]
                        : null;
            }
            set
            {
                if (_dicParameter.ContainsKey(strKey))
                {
                    _dicParameter[strKey] = value;
                }
                else
                {
                    _dicParameter.Add(strKey, value);
                }
            }
        }

    }
}
